using System.Data;
using ET;
namespace DAL
{
    public class Ethnic_DAL
    {
        private readonly clsConnect cls = new clsConnect();

        #region Getdata
        public DataTable BindGirdtb_Ethnic(string keywords)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@KeyWords", keywords);
            return cls.GetData("sp_tb_Ethnic_Search");
        }
        public DataTable BindGirdtb_EthnicDetail(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Ethnic_Id", id);
            return cls.GetData("sp_tb_Ethnic_Detail");
        }
        #endregion

        #region Insert
        public bool Inserttb_Ethnic(Ethnic_ET data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Ethnic_Alias", data.Ethnic_Alias);
            cls.AddParameter("@Ethnic_Name", data.Ethnic_Name);
            cls.AddParameter("@Ethnic_Note", data.Ethnic_Note);
            cls.AddParameter("@Ethnic_User_Add", data.Ethnic_User_Add);
            cls.AddParameter("@Ethnic_Date_Add", data.Ethnic_Date_Add);
            cls.AddParameter("@Ethnic_Computer_Add", data.Ethnic_Computer_Add);
            return cls.ExecuteNonQuery("sp_tb_Ethnic_Insert");
        }
        #endregion

        #region Update
        public bool Updatetb_Ethnic(Ethnic_ET data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Ethnic_ID", data.Ethnic_ID);
            cls.AddParameter("@Ethnic_Alias", data.Ethnic_Alias);
            cls.AddParameter("@Ethnic_Name", data.Ethnic_Name);
            cls.AddParameter("@Ethnic_Note", data.Ethnic_Note);
            cls.AddParameter("@Ethnic_User_Modify", data.Ethnic_User_Modify);
            cls.AddParameter("@Ethnic_Date_Modify", data.Ethnic_Date_Modify);
            cls.AddParameter("@Ethnic_Computer_Modify", data.Ethnic_Computer_Modify);
            return cls.ExecuteNonQuery("sp_tb_Ethnic_Update");
        }
        #endregion

        #region Delete
        public bool Deletetb_Ethnic(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Ethnic_ID", id);
            return cls.ExecuteNonQuery("sp_tb_Ethnic_Delete");
        }
        #endregion
    }
}